package com.lagou.service1.impl;

import com.lagou.api.HelloService;
import org.apache.dubbo.rpc.RpcContext;

import java.util.concurrent.TimeUnit;

public class DogServiceImpl implements HelloService {

    /////////////////////////// 作业1 ///////////////////////////////////
    @Override
    public String sayHello(String name) {
        return "服务1:" + name;
    }

    /////////////////////////// 作业2 ///////////////////////////////////
    @Override
    public String fn1(String name) {
        try {
            TimeUnit.MILLISECONDS.sleep((int) (Math.random() * 100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "服务1-fn1: " + name;
    }

    @Override
    public String fn2(String name) {
        try {
            TimeUnit.MILLISECONDS.sleep((int) (Math.random() * 100) );
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "服务1-fn2: " + name;
    }

    @Override
    public String fn3(String name) {
        try {
            TimeUnit.MILLISECONDS.sleep((int) (Math.random() * 100) );
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "服务1-fn3: " + name;
    }
}